package com.yenlien.traceyun.plant.dao;


import com.yenlien.traceyun.plant.entity.Alarm;
import com.yenlien.traceyun.webase.dao.BaseJpaDao;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author jialong
 * @date 2021/10/17
 * @description:
 **/

public interface AlarmDao extends BaseJpaDao<Alarm> {

    @Query(value = "SELECT * FROM t_alarm WHERE `time` BETWEEN ?1 AND ?2", nativeQuery = true)
    List<Alarm> getHistoryData(String startTime, String endTime);


    @Query(value = "SELECT * FROM t_alarm ", nativeQuery = true)
    List<Alarm> getHistoryData();


    @Query(value = "SELECT * FROM t_alarm ORDER BY `time` DESC LIMIT ?1", nativeQuery = true)
    List<Alarm> getHistoryDataNum(Integer num);


    @Query(value = "SELECT * FROM t_alarm WHERE f_type = ?2 ORDER BY `time` DESC LIMIT ?1", nativeQuery = true)
    List<Alarm> getHistoryDataNum(Integer num, String type);
}
